<template>
	<u-navbar :is-back="true" :title="title" :background="background" :border-bottom="false" height="44"
		:title-size="titleSize" :back-icon-color="backIconColor" :title-color="titleColor" :custom-back="back" />
</template>

<script>
	export default {
		props: {
			title: {
				type: String,
				default: '小律懂法',
			},
			background: {
				type: Object,
				default: () => {
					return {
						backgroundColor: '#ffffff'
					}
				}
			},
			backIconColor: {
				type: String,
			},
			titleColor: {
				type: String,
				default: "#333333",
			},
			customBack: {
				type: Function,
				default: null
			},
			titleSize:{
				type:Number,
				default:32,
			}
		},
		methods: {
			back() {
				if (this.customBack) {
					return this.customBack();
				} else {
					return this.defaultBack();
				}
			},
			defaultBack() {
				if (getCurrentPages().length <= 1) {
					uni.switchTab({
						url: '/pages/home/home'
					})
				} else {
					uni.navigateBack();
				}
			}
		}
	}
</script>

<style>
</style>
